package com.rem.spring.xmlTx.dao;

import com.rem.spring.entity.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author Rem
 * @date 2023-03-06
 */
@Repository
public class EmpDaoImpl implements EmpDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void updateEmpById(Emp emp) {
        String sql = "update t_emp set name=? and age=? and sex=? where id= ?";
        jdbcTemplate.update(sql, emp.getName(), emp.getAge(), emp.getSex(), emp.getId());

        //   String sql = "update t_emp set name= ? where id= ?";
        //   jdbcTemplate.update(sql, emp.getName(), emp.getId());
    }
}
